import sqlite3
import pymysql
from  pymysql.cursors import DictCursor

conn = pymysql.connect(cursorclass=DictCursor, host="10.2.0.74", port=3306, user="ggchat", database="ggchat", password="123456", autocommit=True)

# use select to query rows.
cursor = conn.cursor()
result = cursor.execute("select * from user")
for row in cursor.fetchall():
    print(row)

# use insert to add more rows
# result = cursor.execute("insert into user values (3, 'miranda', '1234567890', '1234567890', 'miranda')")
# conn.commit()
# print("inserted %d rows" % result)

# delete rows.
# result = cursor.execute("delete from user where id=3")
# conn.commit()
# print("deleted %d rows" % result)

cursor.close()
conn.close()

